#include <stdio.h>
#include <fcntl.h>

#define STDIN 0
static void _set_unblock(void) {
    long flags = fcntl(STDIN, F_GETFL, 0);
    flags |= O_NONBLOCK;
    fcntl(STDIN, F_SETFL, flags);
}

int main(void){
    int ret = 0;
    char buf[100];
    _set_unblock();
    printf("input cmd\n");
    while(1) {
        ret = scanf("%s", buf);
       
        if( ret > 0 ) {
            printf("input %d %s\n", ret, buf);
        }
        usleep(100*1000);
    }
    return 0;
}



